Skip to content

[feat] Configurable VM class on base cluster; dhctl bootstrap SSH key & passphrase#15

Merged
krpsh123 merged 8 commits intomainfrom
feature/test-cluster-virtual-machine-class-name
May 7, 2026
Merged

[feat] Configurable VM class on base cluster; dhctl bootstrap SSH key & passphrase#15
krpsh123 merged 8 commits intomainfrom
feature/test-cluster-virtual-machine-class-name

Conversation

@krpsh123
Copy link
Copy Markdown
Contributor

@krpsh123 krpsh123 commented Apr 30, 2026

Summary

VirtualMachineClass on the base cluster

  • Adds TEST_CLUSTER_VIRTUAL_MACHINE_CLASS_NAME so tests can set VirtualMachine.spec.virtualMachineClassName for VMs created on the base cluster in alwaysCreateNew flow (default generic).
  • If the named VirtualMachineClass does not exist, the framework creates it by cloning spec from built-in generic and sets spec.cpu.type to Host. The resource is labeled storage-e2e.deckhouse.io/auto-created=true and is not removed during e2e cleanup (manual cleanup if needed).
  • Virtualization API v1alpha3 (github.com/deckhouse/virtualization/api v1.8.0): scheme registration and VirtualMachineClass client/helpers use v1alpha3 (correct Host CPU / discovery typing).

Dhctl bootstrap SSH (follow-up to deckhouse#19063)

Dhctl resolves SSH via lib-connection ExtractConfig early in bootstrap; mounting only SSH_AUTH_SOCK no longer works reliably (deckhouse/deckhouse#19063).

  • Without SSH_PASSPHRASE: bind-mount the setup-node private key (already uploaded by UploadBootstrapFiles) into the install image at /root/.ssh/id_rsa and pass --ssh-agent-private-keys (alongside existing --ssh-host / --ssh-user).
  • With SSH_PASSPHRASE: generate dhctl connection-config (SSHConfig + SSHHost, dhctl.deckhouse.io/v1) with inline PEM + passphrase, upload to the setup node, run dhctl bootstrap --connection-config=... only (dhctl forbids mixing --connection-config with other --ssh-* flags).

Misc

  • ValidateEnvironment error strings aligned with staticcheck ST1005 (no trailing punctuation).

Environment variables

Variable Default Behavior
TEST_CLUSTER_VIRTUAL_MACHINE_CLASS_NAME generic Empty/unset → generic. Other values must be a valid Kubernetes DNS-1123 subdomain name.
SSH_PASSPHRASE (empty) If set, bootstrap uses dhctl connection-config with passphrase as described above.

Documentation

  • README.md, docs/ARCHITECTURE.md — VM class var + cleanup note; relevant env/bootstrap notes where applicable
  • docs/FUNCTIONS_GLOSSARY.mdCreateVirtualMachines (VM class ensure path)
  • docs/WORKLOG.md — entries for VM class work and bootstrap SSH changes

Add TEST_CLUSTER_VIRTUAL_MACHINE_CLASS_NAME (default generic) as
spec.virtualMachineClassName for VMs created on the base cluster.

If set to a name other than generic, it must be a valid Kubernetes DNS-1123
label (suitable for VirtualMachineClass metadata.name).

When that VirtualMachineClass does not exist, create it by cloning the
built-in generic class with spec.cpu.type Host; label
storage-e2e.deckhouse.io/auto-created=true. Such classes are not deleted during
e2e cleanup.

Documentation, env dumps, glossary, and VirtualMachineClass client updated.

Remove trailing periods from fmt.Errorf strings and use semicolons with
lowercase continuations so error text does not end with punctuation.

Signed-off-by: Pavel Karpov <pavel.karpov@flant.com>
@krpsh123 krpsh123 force-pushed the feature/test-cluster-virtual-machine-class-name branch from 41a041d to 3e49daa Compare May 4, 2026 07:03
@krpsh123 krpsh123 self-assigned this May 4, 2026
@krpsh123 krpsh123 added enhancement New feature or request labels May 4, 2026
Comment thread pkg/cluster/setup.go Outdated
Comment thread pkg/cluster/setup.go Outdated
Comment thread pkg/cluster/setup.go Outdated
Comment thread pkg/cluster/vms.go
Comment thread internal/config/env.go
Comment thread pkg/cluster/vms.go Outdated
…ction-config

dhctl now resolves SSH via lib-connection ExtractConfig early (deckhouse#19063),
so SSH_AUTH_SOCK-only auth fails. Bind-mount the setup-node key and pass
--ssh-agent-private-keys.

When SSH_PASSPHRASE is set, upload dhctl SSHConfig+SSHHost YAML with embedded key
and passphrase; use --connection-config only (dhctl disallows mixing with --ssh-*).

Signed-off-by: Pavel Karpov <pavel.karpov@flant.com>
@krpsh123 krpsh123 changed the title [feat] configurable VirtualMachineClass on base cluster with Host CPU auto-create [feat] Configurable VM class on base cluster; dhctl bootstrap SSH key & passphrase May 6, 2026
krpsh123 added 6 commits May 6, 2026 18:58
…nfig errors

Do not append Exec combined output when cat of the remote private key fails.
Probe readability with test -r first so permission/path issues surface without
reading key material into logs.

Signed-off-by: Pavel Karpov <pavel.karpov@flant.com>
Store the YAML under ~/.config/storage-e2e (0700) via mktemp, chmod 600 the file,
and remove it right after docker run (plus cleanup on earlier failures) instead
of deferring removal until BootstrapCluster returns.

Signed-off-by: Pavel Karpov <pavel.karpov@flant.com>
…ction-config)

- Add UploadPrivate: chmod remote path via SFTP right after Create and before
  copyWithContext, so defaults like 0644 do not apply during payload transfer
  (CWE-732 / review feedback).
- Refactor direct/jump SFTP upload retries around uploadOverSFTPOnce.
- BootstrapCluster passphrase branch: use UploadPrivate(0600), drop separate Exec
  chmod; stage ~/.config/storage-e2e with install -d -m 0700.
- ARCHITECTURE: mention UploadPrivate under ssh responsibilities.

Signed-off-by: Pavel Karpov <pavel.karpov@flant.com>
…eric with Host CPU

Signed-off-by: Pavel Karpov <pavel.karpov@flant.com>
Signed-off-by: Pavel Karpov <pavel.karpov@flant.com>
…t if missing

Signed-off-by: Pavel Karpov <pavel.karpov@flant.com>
@krpsh123 krpsh123 force-pushed the feature/test-cluster-virtual-machine-class-name branch from 7bb5c3e to 12be30a Compare May 6, 2026 19:53
@krpsh123 krpsh123 marked this pull request as ready for review May 6, 2026 19:54
@krpsh123 krpsh123 requested a review from szhem May 6, 2026 20:04
@krpsh123 krpsh123 merged commit c7702ad into main May 7, 2026
1 check passed
@krpsh123 krpsh123 deleted the feature/test-cluster-virtual-machine-class-name branch May 7, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants